package alkuperainen;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.text.*;
import java.util.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author juhohaar
 */
public class TapahtumaTest {

    public Tapahtuma t1;
    public Tapahtuma t2;
    public Tapahtuma t3;

    public TapahtumaTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {

    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
        t1 = new Tapahtuma("Ohtu Luento", "A111", 1, 10, 15, 1, 1, 2011, 11, 00, 1, 5, 2011);
        t2 = new Tapahtuma("Ohtu Luento", "A111", 1, 12, 15, 3, 1, 2011, 13, 59, 3, 5, 2011);
        t3 = new Tapahtuma("Ohtu Luento", "A111", 1, 12, 15, 2, 1, 2011, 13, 59, 3, 5, 2011);
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of getNimi method, of class Tapahtuma.
     */
    @Test
    public void testGetNimi() {
        System.out.println("getNimi");
        Tapahtuma instance = t1;
        String expResult = "Ohtu Luento";
        String result = instance.getNimi();
        assertEquals(expResult, result);
    }

    /**
     * Test of getPaikka method, of class Tapahtuma.
     */
    @Test
    public void testGetPaikka() {
        System.out.println("getPaikka");
        Tapahtuma instance = t2;
        String expResult = "A111";
        String result = instance.getPaikka();
        assertEquals(expResult, result);
    }

    /**
     * Test of getTyyppi method, of class Tapahtuma.
     */
    @Test
    public void testGetTyyppi() {
        System.out.println("getTyyppi");
        Tapahtuma instance = t1;
        int expResult = 1;
        int result = instance.getTyyppi();
        assertEquals(expResult, result);
    }

    /**
     * Test of getPaiva method, of class Tapahtuma.
     */
    @Test
    public void testGetPaiva() {
        System.out.println("getPaiva");
        Tapahtuma instance = t1;
        GregorianCalendar pv = new GregorianCalendar(2011, 0, 1, 10, 15);
        String expResult = "";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY)
			expResult = "Maanantai";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY)
			expResult = "Tiistai";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY)
			expResult = "Keskiviikko";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY)
			expResult = "Torstai";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY)
			expResult = "Perjantai";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
			expResult = "Lauantai";
        if (pv.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
			expResult = "Sunnuntai";


        String result = instance.getPaiva();
        System.out.println(result);
        assertEquals(expResult, result);
    }

    /**
     * Test of getPaivaIndex method, of class Tapahtuma.
     */
    @Test
    public void testGetPaivaIndex() {
        System.out.println("getPaivaIndex");
        Tapahtuma instance = t1;
        int expResult = Calendar.SATURDAY-2;
        int result = instance.getPaivaIndex();
        assertEquals(expResult, result);
    }

    /**
     * Test of getAlkupaiva method, of class Tapahtuma.
     */
    @Test
    public void testGetAlkupaiva() {
        System.out.println("getAlkupaiva");
        Tapahtuma instance = t1;
        String expResult = "1.1.2011";
        String result = instance.getAlkupaiva();
        assertEquals(expResult, result);
    }

    /**
     * Test of getLoppupaiva method, of class Tapahtuma.
     */
    @Test
    public void testGetLoppupaiva() {
        System.out.println("getLoppupaiva");
        Tapahtuma instance = t1;
        String expResult = "1.5.2011";
        String result = instance.getLoppupaiva();
        assertEquals(expResult, result);
    }

    /**
     * Test of getAlkuaika method, of class Tapahtuma.
     */
    @Test
    public void testGetAlkuaika() {
        System.out.println("getAlkuaika");
        Tapahtuma instance = t1;
        String expResult = "10:15";
        String result = instance.getAlkuaika();
        assertEquals(expResult, result);
    }

    /**
     * Test of getAlkutunti method, of class Tapahtuma.
     */
    @Test
    public void testGetAlkutunti() {
        System.out.println("getAlkutunti");
        Tapahtuma instance = t1;
        int expResult = 10;
        int result = instance.getAlkutunti();
        assertEquals(expResult, result);
    }

    /**
     * Test of getAlkuminuutti method, of class Tapahtuma.
     */
    @Test
    public void testGetAlkuminuutti() {
        System.out.println("getAlkuminuutti");
        Tapahtuma instance = t1;
        int expResult = 15;
        int result = instance.getAlkuminuutti();
        assertEquals(expResult, result);
    }

    /**
     * Test of getLopputunti method, of class Tapahtuma.
     */
    @Test
    public void testGetLopputunti() {
        System.out.println("getLopputunti");
        Tapahtuma instance = t1;
        int expResult = 11;
        int result = instance.getLopputunti();
        assertEquals(expResult, result);
    }

    /**
     * Test of getLoppuaika method, of class Tapahtuma.
     */
    @Test
    public void testGetLoppuaika() {
        System.out.println("getLoppuaika");
        Tapahtuma instance = t1;
        String expResult = "11:0";
        String result = instance.getLoppuaika();
        assertEquals(expResult, result);
    }
}
